Auto merge of #5030 - alexcrichton:better-poll, r=matklad
authorbors <bors@rust-lang.org>
Mon, 12 Feb 2018 17:53:00 +0000 (17:53 +0000)
committerbors <bors@rust-lang.org>
Mon, 12 Feb 2018 17:53:00 +0000 (17:53 +0000)
commitcb30fba4a35d8716ed490cc9a220ae99701d8015
tree7fdab5f686b5296449c86ef6e503408d77bf1275
parent43a62ba28cf92b8158b880e536e25049fe9271de
parentec991ebcb90149281f8601f7a1dd7f621268fd9a
Auto merge of #5030 - alexcrichton:better-poll, r=matklad

Don't spin on empty fds in `read2` on Unix

This commit fixes what I think is some pathological behavior in Cargo where if
one stdio stream is closed before another then Cargo can accidentally spin in a
tight loop and not block appropriately. Previously, for example, if stderr
closed before stdout then Cargo would spin in a `poll` loop continuously getting
notified that stderr is closed.

The behavior is now changed so after a file descriptor is done we stop passing
it to `poll` and instead only pass the one remaining readable file descriptor.